<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="./ext/resources/css/ext-all.css" />
<script type="text/javascript" src="./ext/ext-all.js"></script>
<script type="text/javascript" src="./ext/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="./js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="./highcharts/highcharts.js"></script>
<script type="text/javascript" src="./highcharts/exporting.js"></script>
<script type="text/javascript" src="./highcharts/themes/gray.js"></script>
<script type="text/javascript" src="./js_src/statisticcharts.js"></script>
<title>用户反馈统计</title>
</head>
<body>
	<div id="tool_bar"
		style="margin-left: 100px; height: 180px; width: 90%; margin-right: 100px; margin-top: 20px"></div>
	<div id="user_feedback_statistics"
		style="width: 90%; margin-left: 100px; height: 700px; margin-right: 100px; margin-top: 20px"></div>
	<script type="text/javascript">
		var mWindow = Ext.create('Ext.panel.Panel', {
			title : "查询问卷版本记录",
			region : "center",
			bodyStyle : 'padding:6px 0px 0px 15px',
			width : Ext.get("tool_bar").getWidth(),
			height : Ext.get("tool_bar").getHeight(),
			items : [ {
				xtype : 'textfield',
				name : 'sheet',
				id : 'sheet',
				fieldLabel : '版本号',
				padding : '10 5 3 10',
				width : 200,
				labelWidth : 50,
				height : 20,
			}, {
				xtype : 'button',
				style : "margin-left:70px",
				text : '查询',
				handler : function() {
					var sheet= Ext.getCmp("sheet").getValue().trim();
					Ext.Ajax.request({
						url : 'userstatistics',
						params : {
							adminOpt : 'feedbackStatistc',
							sheet : sheet,
						},
						success : function(response) {
							var result = response.responseText;
							console.info(result);
							var series = [];
							var categories = [];
							var trueData = [];
							var falseData = [];
							result = Ext.decode(result);
							$.each(result, function(name, value) {
								categories.push(name);
								$.each(value, function(i, j) {
									if (i == "true") {
										trueData.push(j);
									} else if (i == "false") {
										falseData.push(j);
									}
								});
							});
							var trueObj = {
								type : 'column',
								name : '选择为true',
								data : trueData,
							};
							var falseObj = {
								type : 'column',
								name : '选择为false',
								data : falseData,
							}
							series.push(trueObj);
							series.push(falseObj);
							console.info(series);
							$('#user_feedback_statistics').highcharts({
								title : {
									text : '用户反馈情况图表'
								},
								xAxis : {
									categories : categories,
								},
								yAxis : {
									title : {
										text : '答案数量',
									}
								},
								series : series,
								tooltip : {
									crosshairs : [ true, true ]
								}
							});
						}
					});
				}
			} ],
			renderTo : 'tool_bar',
		});
	</script>
</body>
</html>